            
;    Filename:	  00Bobinetesteur190213
;Test une bobinne d'allumade quelquesoit son impdance de 0.5  5 ohms,  5ms soit 6000t/mn pour un moteur 4 cylindres
	ERRORLEVEL	-302, -301
	list      p=16F628A           ; list directive to define processor
	#include <p16F628A.inc>         ; processor specific variable definitions
;Sans quartz, release, MCLR pin4 relie en interne
	__CONFIG   _CP_OFF & _WDT_OFF& _PWRTE_ON  &_LVP_OFF & _INTRC_OSC_NOCLKOUT & _MCLRE_Off
 
;Avec quartz, debug, MCLRE pin4 sous controle de LCD3   relier au +5V avec 10kohms OBLIGATOIRE!

;	__CONFIG   _CP_OFF & _WDT_OFF& _PWRTE_OFF  &_LVP_OFF & _XT_OSC &_MCLRE_ON  
   

	#DEFINE	OUT	PORTA,1		;pin18  , sortie vers IGBT et  bobine 
;**********************************************************************
START	ORG    0             	; MEM FLASH (2K)
	goto	Main	
			
Main
  	call		INIT			;Initialiser les IO
Ion
  	bsf		OUT		;IGBT on, Ion dans la bobine
  	call		WAIT_1ms	;3 ms on
  	call		WAIT_1ms
  	call		WAIT_1ms
  	bcf		OUT		;Etincelle
  	call		WAIT_1ms	;2 ms off
  	call		WAIT_1ms
	goto	Ion		

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;     
INIT				;SUB d'initialisations
	movlw	7
	movwf 		cmcon		;desactive le comparateur.Indispensable!
		
	banksel		TRISA
	bcf			TRISA,1	;output pin 18
		
	banksel		0
	bcf			OUT
	return   
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;  
WAIT_1ms		;SUB attente 1ms
 	movlw	d'250'	
 	call		WAIT_4w
 ;	movlw	d'250'	
 ;	call		WAIT_4w 	
 ;	movlw	d'250'	
 ;	call		WAIT_4w 	
  ;	movlw	d'250'	
 ;	call		WAIT_4w
 	return
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
WAIT_4w		;SUB attente 4w s
 	addlw	-1
 	btfss	STATUS,Z
 	goto	$-2
 	return
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 	END                    	; directive 'end of program':::::::::::::


	


